<?php

namespace app\common\controller;

use think\Controller;

class Backend extends Controller
{
    protected $user = null;

    protected function initialize()
    {
        $this->user = session( 'auth_user' );
        $this->checkLogin();
    }

    /**
     * 检测是否登录
     */
    protected function checkLogin()
    {
        if ( !$this->user )
        {
            $this->error( '请先登录系统', url( 'login/index' ) );
        }
    }
}